from flask import Flask

app = Flask(__name__)
# 基本用法
# print(app.config)
# app.config['REDIS'] = 'redis://127.0.0.1/1'
# print(app.config.get('REDIS'))


# 加载配置方式一:从类中加载(方便)
# class Config(object):
#     REDIS = 'redis://127.0.0.1/1'
# app.config.from_object(Config)


# 加载配置方式二:从配置文件中加载(安全)
# app.config.from_pyfile('d02_config.ini')


# 加载配置方式三:从环境变量中加载,它的本质是从文件中加载(灵活,安全)
app.config.from_envvar('D02CONFIG')
print(app.config.get('REDIS'))


@app.route('/index')
def index():
    return 'index'

if __name__ == '__main__':
    app.run()
